package model

import "gorm.io/gorm"

// Merchant 商家表
type Merchant struct {
	gorm.Model
	Name    string  `gorm:"type:varchar(30);comment:商家名称"`
	Phone   string  `gorm:"type:varchar(11);comment:联系方式"`
	Cate    string  `gorm:"type:varchar(50);comment:主营分类"`
	Address string  `gorm:"type:varchar(100);comment:商家地址"`
	Rating  float64 `gorm:"type:decimal(10,2);comment:商家评分"`
}

// Order 订单表
type Order struct {
	gorm.Model
	MerchantId uint    //商家ID
	UserId     uint    //用户ID
	ShopId     uint    //商品ID
	RiderId    uint    //骑手ID
	OrderSn    string  `gorm:"type:varchar(100);comment:订单号"`
	Address    string  `gorm:"type:varchar(100);comment:收货地址"`
	Stock      int     `gorm:"type:int(11);comment:购买数量"`
	Total      float64 `gorm:"type:decimal(10,2);comment:总金额"`
	Status     int     `gorm:"type:int;comment:订单状态 0-取餐中 1-配送中 2-已送达"`
}

// Shop 商品表
type Shop struct {
	gorm.Model
	Name  string  `gorm:"type:varchar(50);comment:商品名称"`
	Price float64 `gorm:"type:decimal(10,2);comment:商品价格"`
	Num   int     `gorm:"type:int(11);comment:商品库存"`
}

// Rider 骑手表
type Rider struct {
	gorm.Model
	Name   string `gorm:"type:varchar(20);comment:骑手姓名"`
	Phone  string `gorm:"type:char(11);comment:手机号"`
	Accept int    `gorm:"type:int(11);comment:接单量"`
}

// Appoint 预约表
type Appoint struct {
	gorm.Model
	MerchantId uint   //商家ID
	UserId     uint   //用户ID
	Date       string `gorm:"type:varchar(50);comment:预约时间"`
	Address    string `gorm:"type:varchar(100);comment:预约地址"`
	Num        int    `gorm:"type:int(11);comment:预约人数"`
	Phone      string `gorm:"type:char(11);comment:联系方式"`
	Code       int    `gorm:"type:int;comment:预约码"`
}

// Content 评论表
type Content struct {
	gorm.Model
	UserId     uint   //评论用户ID
	MerchantId uint   //被评论商家ID
	Comment    string `gorm:"type:varchar(100);comment:用户评价"`
}

// Reminder 预约提醒表
type Reminder struct {
	gorm.Model
	AppointId uint   //预约ID
	Address   string `gorm:"type:varchar(100);comment:预约地址"`
	Date      string `gorm:"type:varchar(50);comment:预约时间"`
	Num       int    `gorm:"type:int(11);comment:预约人数"`
}

// Point 自提点表
type Point struct {
	gorm.Model
	Name    string `gorm:"type:varchar(100);comment:自提点名称"`
	Address string `gorm:"type:varchar(200);comment:自提点地址"`
	Date    string `gorm:"type:varchar(50);comment:营业时间"`
}
